<template>
  <Portlet title="物流评价" >
    <el-form ref="evaluationForm" class="el-form-col el-form-s" :model="evaluationParam" label-position="left" label-width="130px">
      <el-row :gutter="15">
        <el-col :span="24">
          <el-form-item label="物流评价:" prop="stars">
            <div class="pull-right">
              <i class="fa fa-info-circle font-blue"></i>
              <span v-if="isAbnormal == 1">订单存在异常，需手动确认</span>
              <span v-if="isAbnormal != 1">默认好评: {{autoEvaluationTime | filterDayHours}}</span>
            </div>
            <el-rate v-model="evaluationParam.stars"></el-rate>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="tools" class="tools">
      <a href="javascript:;" class="collapse"></a>
    </div>
  </Portlet>
</template>
<script>
import {filterDayHours} from '@/filters'
export default {
  name: 'evaluationCarrier',
  components: {
  },
  data() {
    return {
      evaluationParam: {
        fhbOrderId: this.id,
        stars: 5,
        pictures: [],
        memo: '',
        tips: []
      },
      tipsArr: [],
      evaluationLoading: false
    }
  },
  watch: {
    'evaluationParam.stars'(val, oldVal) {
      if (val) {
        this.$emit('evaluationCarrier', val)
      }
    }
  },
  filters: {
  },
  props: {
    id: {
      type: String,
      default: ''
    },
    autoEvaluationTime: {
      type: [String, Number],
      default: 0
    },
    isAbnormal: {
      type: String,
      default: ''
    }
  },
  computed: {
  },
  created() {
    if (this.id) {
      this.$ajax.get('/ms-fahuobao-order/FhbOrder/evaluation-detaile', {orderId: this.id}).then(response => {
        if (response) {
          this.evaluationDetail = response.data
        }
      })
    }
  },
  methods: {
    filterDayHours
  }
}
</script>
